home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Demos / Component Software / FileFlex 2.0.3.sit / FileFlex 2.0.3 / Unsupported & Undocumented / Char Translation Example / 00001_Script_1 next >
Text File  |  1996-04-10  |  10KB  |  393 lines

  1. -- Copyright 1992-1996 David Gewirtz under license to Component Software Corp. 
  2. -- All rights reserved worldwide.
  3. -- This file corresponds to FileFlex v2.01
  4.  
  5. ------------------------------------------------------------------------------------------------------------------------
  6. -- Following are the only wrapper scripts you should consider modifying.  In Director 5 and
  7. -- above, FileFlex has been implemented as a Director-native Xtra.  By placing the FileFlex
  8. -- engine inside your Xtras folder (this is in the same directory/folder as your Director 
  9. -- application or your projector application, FileFlex will be automatically loaded.  If, for
  10. -- some reason, you choose to place the FileFlex engine somewhere else, then you'll need
  11. -- to modify the following wrapper scripts to locate and open FileFlex.  Note that we will
  12. -- not provide technical support to users choosing to use this method.
  13. ------------------------------------------------------------------------------------------------------------------------
  14.  
  15. on DBInitPlatform
  16.   global gDBGlobalPtr1030
  17.   put empty into gDBGlobalPtr1030
  18.   --openXlib "FileFlex Engine"  --<---------------------------- Be sure your pathspec is correct
  19. end DBInitPlatform
  20.  
  21. on DBClosePlatform
  22.   --closeXlib "FileFlex Engine"  --<---------------------------- Be sure your pathspec is correct
  23. end DBClosePlatform
  24.  
  25.  
  26. ------------------------------------------------------------------------------------------------------------------------
  27. -- Following here are the individual wrapper functions that control access to 
  28. -- the FileFlex engine.  We strongly recommend you change these only with
  29. -- great care.
  30. ------------------------------------------------------------------------------------------------------------------------
  31.  
  32. on DBVersion
  33.   return FileFlex("0")
  34. end DBVersion
  35.  
  36. on DBCopyright
  37.   return FileFlex("999")
  38. end DBCopyright
  39.  
  40. on DBOpenSession
  41.   global gDBActive1030
  42.   if gDBActive1030 <> "true" then
  43.     put "true" into gDBActive1030
  44.     return FileFlex("1")
  45.   else
  46.     return "0"
  47.   end if
  48. end DBOpenSession
  49.  
  50. on DBCloseSession
  51.   global gDBActive1030
  52.   if gDBActive1030 = "true" then
  53.     put "" into gDBActive1030
  54.     return FileFlex("2")
  55.   else
  56.     return "0"
  57.   end if
  58. end DBCloseSession
  59.  
  60. on DBUse dbName, pathspec
  61.   DBCheckActive
  62.   if the paramCount = 1 then
  63.     return FileFlex("3",dbName)
  64.   else
  65.     return FileFlex("3",dbName,pathspec)
  66.   end if
  67. end DBUse
  68.  
  69. on DBDatabaseExists dbName, pathspec
  70.   DBCheckActive
  71.   if the paramCount = 1 then
  72.     return FileFlex("43",dbName)
  73.   else
  74.     return FileFlex("43",dbName,pathspec)
  75.   end if
  76. end DBUse
  77.  
  78. on DBClose dbID
  79.   DBCheckActive
  80.   return FileFlex("4",string(dbID))
  81. end DBClose
  82.  
  83. on DBSelect dbID
  84.   DBCheckActive
  85.   return FileFlex("5",string(dbID))
  86. end DBSelect
  87.  
  88. on DBCloseAll
  89.   DBCheckActive
  90.   return FileFlex("6")
  91. end DBCloseAll
  92.  
  93. on DBUseIndex indexName, pathspec
  94.   DBCheckActive
  95.   if the paramCount = 1 then
  96.     return FileFlex("7",indexName)
  97.   else
  98.     return FileFlex("7",indexName, pathspec)
  99.   end if
  100. end DBUseIndex
  101.  
  102. on DBCloseIndex indexID
  103.   DBCheckActive
  104.   return FileFlex("8",string(indexID))
  105. end DBCloseIndex
  106.  
  107. on DBSelectIndex indexID
  108.   DBCheckActive
  109.   return FileFlex("9",string(indexID))
  110. end DBSelectIndex
  111.  
  112. on DBGo recnum
  113.   DBCheckActive
  114.   return FileFlex("10",string(recnum))
  115. end DBGo
  116.  
  117. on DBTop
  118.   DBCheckActive
  119.   return FileFlex("11")
  120. end DBTop
  121.  
  122. on DBBottom
  123.   DBCheckActive
  124.   return FileFlex("12")
  125. end DBBottom
  126.  
  127. on DBSeek seekExpr
  128.   DBCheckActive
  129.   return FileFlex("13",seekExpr)
  130. end DBSeek
  131.  
  132. on DBSkip num
  133.   DBCheckActive
  134.   return FileFlex("14",string(num))
  135. end DBSkip
  136.  
  137. on DBDeleteRecs startRec, endRec
  138.   DBCheckActive
  139.   return FileFlex("15",string(startRec), string(endRec))
  140. end DBDeleteRecs
  141.  
  142. on DBRecallRecs startRec, endRec
  143.   DBCheckActive
  144.   return FileFlex("16",string(startRec), string(endRec))
  145. end DBDeleteRecs
  146.  
  147. on DBZapRecs startRec, endRec
  148.   DBCheckActive
  149.   return FileFlex("17",string(startRec), string(endRec))
  150. end DBZapRecs
  151.  
  152. on DBPack
  153.   DBCheckActive
  154.   return FileFlex("18")
  155. end DBPack
  156.  
  157. on DBCount
  158.   DBCheckActive
  159.   return FileFlex("19")
  160. end DBCount
  161.  
  162. on DBRecordDeleted recNum
  163.   DBCheckActive
  164.   return FileFlex("20", string(recNum))
  165. end DBRecordDeleted
  166.  
  167. on DBCurrRecNum
  168.   DBCheckActive
  169.   return FileFlex("21")
  170. end DBCurrRecNum
  171.  
  172. on DBSum numFieldName
  173.   DBCheckActive
  174.   return FileFlex("22",numFieldName)
  175. end DBSum
  176.  
  177. on DBAverage numFieldName
  178.   DBCheckActive
  179.   return FileFlex("22", numFieldName) / FileFlex("19")
  180. end DBAverage
  181.  
  182. on DBGetMemo memoField, encryptFlag, key
  183.   DBCheckActive
  184.   if the paramCount = 1 then
  185.     return FileFlex("24", memoField)
  186.   else
  187.     return FileFlex("24", memoField, encryptFlag, key)
  188.   end if
  189. end DBGetMemo
  190.  
  191. on DBWriteMemo memoField, memoVal, encryptFlag, key
  192.   DBCheckActive
  193.   if the paramCount <= 2 then
  194.     return FileFlex("25",memoField, memoVal)
  195.   else
  196.     return FileFlex("25",memoField, memoVal, encryptFlag, key)
  197.   end if
  198. end DBWriteMemo
  199.  
  200. on DBGetFieldByName fieldName, decryptFlag, key
  201.   DBCheckActive
  202.   if the paramCount  = 1 then
  203.     return FileFlex("26",fieldName)
  204.   else
  205.     return FileFlex("26",fieldname, decryptFlag, key)
  206.   end if
  207. end DBGetFieldByName
  208.  
  209. on DBGetFieldByNum fieldName, decryptFlag, key
  210.   DBCheckActive
  211.   if the paramCount  = 1 then
  212.     return FileFlex("27",string(fieldName))
  213.   else
  214.     return FileFlex("27",string(fieldname), decryptFlag, key)
  215.   end if
  216. end DBGetFieldByNum
  217.  
  218. on DBGetCurrRecVal containerType, decryptList, key
  219.   DBCheckActive
  220.   if the paramCount = 1 then
  221.     return FileFlex("28",containerType)
  222.   else
  223.     return FileFlex("28", containerType, decryptList, key)
  224.   end if
  225. end DBGetCurrRecVal
  226.  
  227. on DBListFields
  228.   DBCheckActive
  229.   return FileFlex("29")
  230. end DBListFields
  231.  
  232. on DBMaxRecs
  233.   DBCheckActive
  234.   return FileFlex("47")
  235. end DBMaxRecs
  236.  
  237. on DBTranslateChars string, table -- new in 2.01
  238.   DBCheckActive
  239.   return FileFlex("48",string, table)
  240. end DBTranslateChars
  241.  
  242. on DBWriteRec containerType, recNum, p0, p1, p2
  243.   if the paramCount = 2 then
  244.     return FileFlex("30",containerType,string(recNum))
  245.   else if the paramCount = 3 then
  246.     return FileFlex("30",containerType, string(recNum), string(p0))
  247.   else if the paramCount = 4 then
  248.     return FileFlex("30",containerType,string(recNum), string(p0), string(p1))
  249.   else
  250.     return FileFlex("30",containerType, string(recNum), string(p0), string(p1),string(p2))
  251.   end if
  252. end DBWriteRec
  253.  
  254. on DBCreateIndex indexName, indexExpr, unique, safety
  255.   DBCheckActive
  256.   return FileFlex("31",indexName, indexExpr, string(unique), string(safety))
  257. end DBCreateIndex
  258.  
  259. on DBSetSortOrder order   -- new in 2.01
  260.   global gDBWorldSort
  261.   global gDBSortOrder
  262.   if order = EMPTY then
  263.     put EMPTY into gDBWorldSort
  264.   else
  265.     put "1" into gDBWorldSort
  266.     put order into gDBSortOrder
  267.   end if
  268.   return 0
  269. end DBSetSortOrder
  270.  
  271. on DBSetCaseTables upperTable, lowerTable  -- new in 2.01
  272.   global gDBWorldCase
  273.   global gDBWorldUpper, gDBWorldLower
  274.   if (upperTable = EMPTY or lowerTable = EMPTY) then
  275.     put EMPTY into gDBWorldCase
  276.   else
  277.     put "1" into gDBWorldCase
  278.     put upperTable into gDBWorldUpper
  279.     put lowerTable into gDBWorldLower
  280.   end if
  281.   return 0
  282. end DBSetCaseTables
  283.  
  284. on DBUpper s -- new in 2.01
  285.   DBCheckActive
  286.   return FileFlex("49",string(s))
  287. end DBUpper
  288.  
  289. on DBLower s -- new in 2.01
  290.   DBCheckActive
  291.   return FileFlex("50",string(s))
  292. end DBLower
  293.  
  294. on DBReindex indexID
  295.   DBCheckActive
  296.   return FileFlex("32", string(indexID))
  297. end DBReindex
  298.  
  299. on DBIndexExpr indexID
  300.   DBCheckActive
  301.   return FileFlex("44", string(indexID))
  302. end DBIndexExpr
  303.  
  304. on DBBuildSeekExpr
  305.   DBCheckActive
  306.   put "FileFlex(" & quote & "45" & quote into theFunc
  307.   repeat with i = 1 to the paramCount
  308.     put "," & quote & string(param(i)) & quote after theFunc
  309.   end repeat
  310.   put ")" after theFunc
  311.   return value(theFunc)
  312. end DBBuildSeekExpr
  313.  
  314. on DBListIndexFields indexID, delim
  315.   DBCheckActive
  316.   return FileFlex("46", string(indexID),string(delim))
  317. end DBListIndexFields
  318.  
  319. on DBCreate dbName, numFields, fields, safety
  320.   DBCheckActive
  321.   return FileFlex("33", dbName, string(numFields), fields,string(safety))
  322. end DBCreate
  323.  
  324. on DBCheckIndex indexID
  325.   DBCheckActive
  326.   return FileFlex("34", string(indexID))
  327. end DBCheckIndex
  328.  
  329. on DBQuery expr
  330.   DBCheckActive
  331.   return FileFlex("35",expr)
  332. end DBQuery
  333.  
  334. on DBLocate expr
  335.   -- NOTE: DBLocate is obsolete and will be eliminated in future releases
  336.   -- DBLocate has been replaced by DBQuery
  337.   DBCheckActive
  338.   return FileFlex("35",expr)
  339. end DBLocate
  340.  
  341. on DBCurrDBNum
  342.   DBCheckActive
  343.   return FileFlex("36")
  344. end DBCurrDBNum
  345.  
  346. on DBEncrypt theString, key
  347.   DBCheckActive
  348.   return FileFlex("38",theString, key)
  349. end DBEncrypt
  350.  
  351. on DBDecrypt theString, key
  352.   DBCheckActive
  353.   return FileFlex( "39", theString, key)
  354. end DBDecrypt
  355.  
  356. on DBFindMemo memoField, theString
  357.   DBCheckActive
  358.   return FileFlex("40",memoField, theString)
  359. end DBFindMemo
  360.  
  361. on DBConvertCRLF theString, theOption
  362.   DBCheckActive
  363.   if the paramCount = 1 then
  364.     return FileFlex("41",theString)
  365.   else
  366.     return FileFlex("41",theString, theOption)
  367.   end if
  368. end DBConvertCRLF
  369.  
  370. on DBPlatform
  371.   DBCheckActive
  372.   return FileFlex("42")
  373. end DBPlatform
  374.  
  375. on DBCheckActive
  376.   global gDBActive1030
  377.   if gDBActive1030 <> "true" then
  378.     put DBOpenSession() into dummy
  379.   end if
  380. end DBCheckActive
  381.  
  382. -- These routines should never be called by the user.  They simply
  383. -- assign and gather values of the global variables.  They are here so
  384. -- we can test the global value interface to the host application
  385. --
  386. on DBSetGlobal globName, globVal
  387.   return FileFlex("202",string(globName),string(globVal))
  388. end DBSetGlobal
  389.  
  390. on DBGetGlobal globName
  391.   return FileFlex("201",string(globName))
  392. end DBGetGlobal
  393.